package custom;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

public class Request {
	
	private int fromId, toId;
	
	public Request(int fromId, int toId){
		this.fromId = fromId;
		this.toId = toId;
	}
	
	/**
	 * abrunebs yvela requestis vectors, romelic am users gamougzavnes
	 * @return
	 * @throws SQLException 
	 */
	public static ArrayList<Request> getAllRequests(int id) throws SQLException{
		//bazidan vigeb requestebs
	/*	ResultSet rs = QuizDBC.getInstance().selectRequests(-1, id);
		ArrayList<Request> list = new ArrayList<Request>();
		while(rs.next()){
			int from = rs.getInt("firstid");
			int to = rs.getInt("secindid");
			Request req = new Request(from, to);
			list.add(req);
		}
		return list;
	*/	return new ArrayList<Request>();
	}
	
	public static boolean requestSend(int id1, int id2){
		return false;
	}
	
	public static void send(int from, int to){
		QuizDBC.getInstance().insertIntoRequests(from, to);
	}
	
	public static void unfriend(int from, int to){
		
	}
	
	public String getHtml(){
		return "";
	}
	
	public static void accept(int from, int to){
		QuizDBC.getInstance().removeFromRequests(from, to);
		QuizDBC.getInstance().insertIntoFriends(from, to);
	}
	
	public static void reject(int from, int to){
		QuizDBC.getInstance().removeFromRequests(from, to);
	}
}
